var exec = require('cordova/exec');

/*
 * startTime/endTime格式
 *
 * {
 *  "year": 2015,
 *  "month": 12,
 *  "day": 30,
 *  "hour": 10,
 *  "minute": 50,
 *  "second": 12
 * }
 *
 */

var main = {
    RecordType: {
        REC_FILE_TYPE_ALL: 255,
        REC_FILE_TYPE_GENERAL: 1,
        REC_FILE_TYPE_MALUAL: 4,
        REC_FILE_TYPE_ALARM: 2,
        REC_FILE_TYPE_PROBE: 8
    },
    search:function(successCallback, errorCallback) {
        exec(successCallback, errorCallback, "ZcVideo", "search", []);
    },
    showVideoView:function(successCallback,errorCallback, umid, userId, pwd, channelNo){ // channelNo从0开始
        exec(successCallback, errorCallback, "ZcVideo", "showVideoView", [umid, userId, pwd, channelNo]);
    },
    connect:function(successCallback,errorCallback, umid, userId, pwd, order){
        exec(successCallback, errorCallback, "ZcVideo", "connect", [umid, userId, pwd, order]);
    },
    searchVideo: function(umid, userId, password, channelNo, startTime, endTime, recordType, succCb, errCb) {
        exec(succCb, errCb, "ZcVideo", "searchVideo", [umid, userId, password, channelNo, startTime, endTime, recordType]);
    },
    playVideo: function(umid, userId, password, channelNo, tVideoFile, succCb, errCb) {
        exec(succCb, errCb, "ZcVideo", "playVideo", [umid, userId, password, channelNo, tVideoFile]);
    },
    changePwd: function(umid, userId, password,newPwd, channelNo, succCb,errCb) {
        exec(succCb, errCb, "ZcVideo", "changePwd", [umid, userId, password, newPwd, channelNo]);
    }
};

module.exports = main;
